home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgramD2.iso
/
Borland
/
Borland C++ V5.02
/
SCRIPT.PAK
/
EXSCR.SPP
< prev
next >
Wrap
Text File
|
1997-05-06
|
2KB
|
50 lines
//--------------------------------------------------------------------------
// Object Scripting
// Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
//
// EXSCR.SPP: Example Scripts Installation.
//--------------------------------------------------------------------------
import scriptEngine;
import IDE;
//#define HKEY_LOCAL_MACHINE (0x80000002)
#define HKEY_CURRENT_USER (0x80000001)
#define KEYPATH "Software\\Borland\\Borland C++\\5.0\\Scripting"
#define VALUE_NAME "InstallExamples"
#define MENU_TEXT "S&cript|Install/Uninstall &examples"
#define MENU_DESCR "Install/Uninstall example scripts"
exscr(){
// Add menu item for example script installation/uninstallation.
//
if (!scriptEngine.IsLoaded("menuhook")) scriptEngine.Load("menuhook");
assign_to_view_menu("IDE", MENU_TEXT, "InstallUninstall();", MENU_DESCR);
//
// Surface selected examples by loading the Script Manager example
// ( == "install" examples) if registry flag is set.
//
if (GetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME) == "1"){
sppman();
}
}
InstallUninstall(){
// Check current state of installation and toggle.
//
if (GetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME) == "1"){
SetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME, "0");
IDE.Message("Restart BCW to complete uninstallation of example scripts.");
}
else {
SetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME, "1");
sppman();
IDE.Message("Example scripts installed. See README.TXT in the script examples directory.");
}
}